package com.repository;

import com.domain.Comment;
import lombok.Data;
import org.springframework.context.annotation.Description;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

//@Classname CommentRepository
//@Description TODO
//@Data 2019-3-4 9:34
//@Created by CrazyStone
public interface CommentRepository extends JpaRepository<Comment,Integer> {
    //根据评论id修改评论作者author
    @Transactional
    @Modifying
    @Query("UPDATE t_comment c SET c.author= ?1 WHERE c.id = ?2")
    public int updateComment(String author,Integer id);
}
